<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
	<ui:composition template="template/template.xhtml">
		<ui:define  name="page-title" >#{messages.entradaStock}</ui:define >
		<ui:define  name="center">
			<h:outputText styleClass="title" value="#{messages.entradaStock}"/>
        	<p:messages id="messages" autoUpdate="true" showSummary="true"/> 
           	
			
			<h:panelGrid columns="2" id="fields">  
	
	 			<h:outputLabel value="#{messages.material}" for="material"/>
	 			<p:selectOneMenu required="true" id="material" value="#{entradaController.entrada.material.id}" style="display: inline-block; vertical-align: middle;" >  
                	<f:selectItem itemLabel="#{messages.seleccione}" itemValue="" /> 
                    <f:selectItems value="#{mercadoriaController.materials}" var="material" itemValue="#{material.id}" itemLabel="#{material.nome}" />  
                </p:selectOneMenu> 
   					
   				<h:outputLabel value="#{messages.centro}" for="centro"/>
	 			<p:selectOneMenu id="centro" value="#{centroController.centro.id}" style="display: inline-block; vertical-align: middle;"  required="true">  
                    <f:selectItem itemLabel="#{messages.seleccione}" itemValue="" /> 
                    <f:selectItems value="#{centroController.centros}" var="centro" itemValue="#{centro.id}" itemLabel="#{centro.nome}" />
                    <p:ajax update="deposito" event="change" process="@this"/>
                </p:selectOneMenu>	
   					
   				<h:outputLabel value="#{messages.deposito}" for="deposito"/>
			 	<p:selectOneMenu id="deposito" value="#{entradaController.entrada.deposito.id}" style="display: inline-block; vertical-align: middle;" required="true">  
                     <f:selectItem itemLabel="#{messages.seleccione}" itemValue="" /> 
                     <f:selectItems value="#{centroController.centroDepositosArmazenamento}" var="deposito" itemValue="#{deposito.id}" itemLabel="#{deposito.nome}" />  
                </p:selectOneMenu> 	
                
                <h:outputLabel value="#{messages.quantidade}" for="quantidade"/>
	 			<p:inputText id="quantidade" value="#{entradaController.entrada.quantidade}" style="display: inline-block; vertical-align: middle;" required="true"/>
			</h:panelGrid>
			
			
  			<div>
 				<p:commandButton update="@form" value="#{messages.guardar}" action="#{entradaController.saveEntrada}"   ajax="false"/> 
 			</div>
		</ui:define >
	</ui:composition>
</html>